package com.baozh.config;

import com.baozh.api.ApiService;
import io.swagger.annotations.Contact;
import io.swagger.annotations.Info;
import io.swagger.annotations.SwaggerDefinition;
import io.swagger.jaxrs.config.BeanConfig;
import org.glassfish.jersey.jackson.JacksonFeature;

import javax.ws.rs.core.Application;
import java.util.HashSet;
import java.util.Set;

/**
 * @author hubert
 * @date 2018/12/11
 * @description SampleApplication
 */
@SwaggerDefinition(info = @Info(description = "描述", version = "版本号", title = "标题", contact = @Contact(name = "联系人姓名", email = "联系人邮箱")), schemes = {
		SwaggerDefinition.Scheme.HTTP }, basePath = "基准路径")
public class SampleApplication extends Application {

	public SampleApplication() {
		BeanConfig beanConfig = new BeanConfig();
		beanConfig.setVersion("1.0.2");
		beanConfig.setSchemes(new String[]{"http"});
		beanConfig.setHost("localhost:8087");
		beanConfig.setBasePath("/rest/api");
		beanConfig.setResourcePackage("com.baozh.api");
		beanConfig.setScan(true);
	}
	@Override
	public Set<Class<?>> getClasses() {
		Set<Class<?>> resources = new HashSet();

		//api入口
		resources.add(ApiService.class);
		//json转换
		resources.add(JacksonFeature.class);
		resources.add(io.swagger.jaxrs.listing.ApiListingResource.class);
		resources.add(io.swagger.jaxrs.listing.SwaggerSerializers.class);

		return resources;
	}
}
